Skip to main content

All Questions

4votes
3answers
238views

Seconds into readable time information

I had an exercise to solve, written in German. I try to translate it: Write a program that takes an amount of seconds. The program than has to output the number of years, days, hours and seconds. My ...
Dexter Thorn's user avatar
4votes
3answers
103views

Java class that does calculations between dates

I am writing a simple java class for date calculations, I am aware there are probably better ones out there, but I want to do this myself for practicing purposes. I am planning on expanding this class ...
Just Half's user avatar
1vote
4answers
228views

Java Date class- switches and ifs in the constructor

I'm a beginner i have an assignment to write a Date class (as part of a bigger project). in my question i focus on the constructor. here's some background: the given guidelines are that the date is ...
Eric Parker's user avatar
2votes
1answer
458views

Day finder program, inputs date, outputs day of the week

I have made this simple program that computes the day the week for the years 1700 - 2399. I am looking for suggestions/ improvement advice. I am not well versed with OOP and would like suggestions on ...
CodeLearner's user avatar
4votes
2answers
2kviews

Matching a time interval using regex

What I needed to do was check whether a given string matches a certain pattern. The pattern is this: 00:00:00,000 --> 00:00:00,000 Things to keep in mind: ...
Morgan's user avatar
4votes
3answers
153views

Computing the name of the month

I created the following program that transforms a numerical month into the corresponding textual month. I initially calculated the starPoint and ...
R. Holland's user avatar
4votes
1answer
2kviews

12/24h Time format converter

I am really new at this and I was wondering if there is a more efficient way of writing this code, which converts time format to 12-hour from 24-hour format, and vice-versa. For example ...
bright's user avatar
4votes
5answers
2kviews

Leap year check in Java

I'm looking for 3 different answers: Using Java predefined functions Converting from string to number Without the above two (any other types of answers are also welcome) I am looking for improving my ...
fidgetyphi's user avatar
12votes
4answers
12kviews

Compute the day of the year

I am new to programming. I saw this Java code with a lot of if-else statements that is copied below. People say that such a code ...
fidgetyphi's user avatar
2votes
3answers
7kviews

Find number of whole weeks between months in the same year

I wrote a class to return the number of whole weeks between months in the same year. I need suggestions on my code. ...
vimal4david's user avatar
4votes
2answers
2kviews

Calculate amount of seconds from user birth date to beginning of current year

I'm trying to make a program where user will put in his birth date in DD/MM/YYYY form and he will get back amount of seconds between his birth day and 01/01/2015. It counts with fact that different ...
SirFedora's user avatar
4votes
1answer
2kviews

Using swing and creating JPanel

I watched bunch of videos about swing and GUI in general and created my first component (correct me if it is not one). JPanel class: ...
Townsheriff's user avatar
9votes
2answers
78kviews

Converting seconds to hours, minutes and seconds

The following question was taken from Absolute Java 5th ed. by Walter Savitch: Write a program that outputs the number of hours, minutes, and seconds that corresponds to 50,391 total seconds. The ...
Oompa Loompa's user avatar
7votes
1answer
10kviews

Simple stop watch

I'd like my code to be solid and good. That's why I want someone a little more experienced to give me some feedback so I can improve. Here is the code for a simple stop watch that I created. I feel ...
user3641882's user avatar
7votes
3answers
26kviews

Alarm clock with "ringing" functionality

I have a question regarding a program that is to run an alarm clock and display the time (HH:MM AM/PM) and also trigger the alarm and display "ringing" at 12:00 AM. I am a beginner in Java and I am a ...
user41135's user avatar

153050per page
close